<?php
namespace app\common\model;

class Task extends App
{
    /**
    * 关联模型
    */
    public $assoc = [
        'Tasktgroup' => [
            'type' => 'belongsTo'
        ],
        'Imggroup' => [
            'type' => 'belongsTo'
        ],
    ];
    
    public function initialize()
    {        
        $this->form = [
            'id' => [
            	'type' => 'integer',
            	'name' => 'ID',
            	'elem' => 'hidden',
            ],
            'taskname' => [
                'type' => 'string',
                'name' => '任务名称',
                'elem' => 'text',
            ],
            'jobdo' => [
                'type' => 'string',
                'name' => '任务动作',
                'elem' => 'select',
                'options' => [
                    '0' => '加好友',
                    '1' => '文字朋友圈',
                    '2' => '邀请入群',
                    '3' => '图文朋友圈',
                ],
            ],
            'jobtype' => [
                'type' => 'string',
                'name' => '任务类型',
                'elem' => 'select',
                'options' => [
                    '0' => '手机端',
                    '1' => '电脑端',
//                    '2' => 'IPAD端',
                ],
            ],
            'tasktgroup_id' => [
                'type' => 'integer',
                'name' => '任务分组',
                'elem' => 'assoc_select',
                'list' => 'assoc',
                'foreign' => 'Tasktgroup.taskgroupname'
            ],
            'imggroup_id' => [
                'type' => 'integer',
                'name' => '图片组',
                'elem' => 'assoc_select',
                'list' => 'assoc',
                'foreign' => 'Imggroup.name'
            ],
            'wxchatgroup' => [
                'type' => 'string',
                'name' => '微信群ID',
                'elem' => 'text',
            ],
            'pyq' => [
                'type' => 'string',
                'name' => '文字信息',
                'elem' => 'textarea',
                'info' => '任务为朋友圈时为朋友圈的文字信息,任务为加好友时为添加好友时的验证信息！'
            ],
            'addnum' => [
                'type' => 'integer',
                'name' => '添加数量',
                'elem' => 'number',
            ],
            'strattime' => [
                'type' => 'string',
                'name' => '开始时间',
                'elem' => 'text',
                'list' => 'edit'
            ],
            'stoptime' => [
                'type' => 'string',
                'name' => '结束时间',
                'elem' => 'text',
                'list' => 'edit'
            ],
            //其他字段
        ];
        call_user_func_array(['parent', __FUNCTION__], func_get_args());
    }
    
    /**
    // 表单分组
    public $formGroup = [
        'advanced' => '高级选项'
    ];
    */
    
    /**
    * 数据验证 
    */
    protected $validate = [];
}
